package com.diankangwo.dao.impl;

import com.diankangwo.dao.ShoppingCartDAO;
import com.diankangwo.domain.ShoppingCart;
import com.diankangwo.util.PageSupport;
import org.springframework.stereotype.Repository;

@Repository
public class ShoppingCartDAOImpl extends BaseDaoImpl<ShoppingCart> implements ShoppingCartDAO {

	@Override
	public PageSupport<ShoppingCart> findByUserId(Integer id,int pageNo,int pageSize) {
		PageSupport<ShoppingCart> shoppingCartList = new PageSupport<>();
		shoppingCartList =  findPagination("from ShoppingCart where userId = ? and status = 0",pageNo,pageSize, id);
		if (shoppingCartList == null || shoppingCartList.getResultData().size() ==0) {
			return null;
		}else{
			return shoppingCartList;
		}
	}

}
